﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using DLL.Teacher操作类DAL;
using Model;
using System.Data;
using System.Data.SqlClient;

namespace BLL.教师操作BLL
{
    public class SelectIpBLL
    {
        SelectIpDAL selectIpDAL = new SelectIpDAL();

        #region 获取数据库中的某个IP数据--DataTable SelectIp()-杨光彩-2018-2-26 10:52:39
        /// <summary>
        /// 获取数据库中的某个IP数据
        /// </summary>
        /// <returns></returns>
        public DataTable SelectIp(IPEntity ipEntity)
        {
            DataTable dt = new DataTable();
            dt = selectIpDAL.SelectIp(ipEntity);
            return dt;
        }
        #endregion


        #region 通过ipname来查询IP--DataTable SelectOneIp(IPEntity ipEntity)--杨光彩--2018-3-1 18:06:21
        /// <summary>
        /// 通过ipname来查询IP
        /// </summary>
        /// <param name="ipEntity"></param>
        /// <returns></returns>
        public DataTable SelectOneIp(IPEntity ipEntity)
        {
            DataTable dt = new DataTable();
            dt = selectIpDAL.SelectOneIp(ipEntity);
            return dt;
        }
        #endregion


        #region 选择所有的IP数据--DataTable SelectAllIp()--杨光彩-2018-3-1 13:58:58
        /// <summary>
        /// 选择所有的IP数据
        /// </summary>
        /// <returns></returns>
        public DataTable SelectAllIp()
        {
            DataTable dt = new DataTable();
            dt = selectIpDAL.SelectAllIp();
            return dt;
        }
        #endregion

        #region 更新IP-吕德彪-2018
        /// <summary>
        /// 更新IP--吕德彪--2018
        /// </summary>
        /// <param name="dt"></param>
        /// <returns></returns>
        public bool UpdateIP(IPEntity ipentity)
        {

            int flag = selectIpDAL.UpdateIP(ipentity);
            if (flag > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        #endregion

        #region 添加新的考场 -吕德彪-2018
        /// <summary>
        /// 添加新的考场
        /// </summary>
        /// <param name="ipentity"></param>
        /// <returns></returns>
        public bool InsertIP(IPEntity ipentity)
        {
            int flag = selectIpDAL.InsertIP(ipentity);
            if (flag > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        #endregion

        #region 删除IP-吕德彪-2018
        public bool DeleteIP(string s)
        {
            int flag = selectIpDAL.DeleteIP(s);
            if (flag > 0)
            {
                return true;
            }
            else
            {
                return false;
            }
        }
        #endregion
    }
}
